# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Étienne Deparis <etienne@depar.is>

pkgname=libnitrokey
pkgver=3.8
pkgrel=1
pkgdesc='Communicate with Nitrokey stick devices in a clean and easy manner'
url='https://www.nitrokey.com'
arch=('x86_64')
license=('LGPL3')
depends=('glibc' 'gcc-libs')
makedepends=('catch2' 'cmake' 'hidapi' 'libusb' 'qt5-tools')
provides=('libnitrokey.so')
options=(debug)
source=(https://github.com/Nitrokey/libnitrokey/releases/download/v${pkgver}/libnitrokey-v${pkgver}.tar.gz{,.sig})
sha512sums=('f986824f642f36d3cd3ebad6fd354843f6045cf0b619f971394f3917f1b447ca72ddae81bdba1886ac95797f07a90b702441b81cbc47618ee629364a348f96ff'
            'SKIP')
b2sums=('02166746e5607bad6d89af195ca08a9c780801e5416553a290ac5e8875aa769afdcec4ad02da8ab85f66ea85772780ac74eacde06c0be5a094247c7421104262'
        'SKIP')
validpgpkeys=('868184069239FF65DE0BCD7DD9BAE35991DE5B22') # Szczepan Zalega <szczepan.zalega@gmail.com>

build() {
  cmake -B build \
    -DBUILD_SHARED_LIBS=ON \
    -DCOMPILE_OFFLINE_TESTS=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -S $pkgname-v$pkgver
  make -C build VERBOSE=1
}

check() {
  ctest -VV --test-dir build
}

package() {
  depends+=(
    hidapi libusb libhidapi-libusb.so
  )
  make -C build DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
